Search Results

Search found 172 results on 7 pages for 'sibling'.

Page 1/7 | 1 2 3 4 5 6 7  | Next Page >

  • [XPATH] Retrieve specific preceding sibling nodes attributes

    - by Matthieu BROUILLARD
    Is there an XPath way of recovering directly one specific attribute of preceding sibling nodes of an XML node using an XPath query? In the following example, I would like to retrieve the values of the alt attribute of each img nodes that precede the div element marked with the id=marker. <content> <img alt="1" src="file.gif" /> <img alt="2" src="file.gif" /> <img alt="3" src="file.gif" /> <img alt="4" src="file.gif" /> <div id='marker'></div> </content> For this example, I want to retrieve the values 1 2 3 4. I use the following XPath query //div[@id='marker']/preceding-sibling::img in order to retrieve the node list I want <img alt="1" src="file.gif"/> <img alt="2" src="file.gif"/> <img alt="3" src="file.gif"/> <img alt="4" src="file.gif"/> As it is a node list I can then iterate on the nodes to retrieve the attribute value I am looking for, but is there an XPath way of doing it? I would have expected to be able to write something like: //div[@id='marker']/preceding-sibling::img@alt or //div[@id='marker']/preceding-sibling@alt::img but I don't even know if it is possible once you have used an XPath Axe like preceding-sibling.

    Read the article

  • Removing active class and adding it to a sibling

    - by Kyle
    Currently, I have a jQuery Cycle plugin that allows the image to scroll. With it's callback I am calling this function function onAfterVideoScroll() { $('.myRemote.active').removeClass("active").next().addClass("active"); } This SHOULD be removing the current class from another set of links, and adding the class to the it's next sibling. This is to keep whichever image is showing it's button predecessor will be active so the user can tell which button is currently showing on the slideshow. If this makes sense, please let me know why it will remove the active class but it never gives the sibling the active class. Thanks!

    Read the article

  • beautifulsoup: find the n-th element's sibling

    - by deostroll
    I have a complex html DOM tree of the following nature: <table> ... <tr> <td> ... </td> <td> <table> <tr> <td> <!-- inner most table --> <table> ... </table> <h2>This is hell!</h2> <td> </tr> </table> </td> </tr> </table> I have some logic to find out the inner most table. But after having found it, I need to get the next sibling element (h2). Is there anyway you can do this?

    Read the article

  • jquery access sibling TD in table

    - by Rob
    I have the following HTML Code. What I'm try to do is to have the div named javaRatingDiv to be displayed once the checkbox with the name java is checked. I can't seem to figure out how to navigate to the next TD in a table via jquery. <div id="languages"> <table style="width:inherit"> <tr style="height:50px; vertical-align:top"> <td>Select the languages that you are familiar with and rate your knowledge:</td> </tr> <tr> <table style="width:75%;" align="center"> <tr id="tableRow"> <td id="firstTD"><input type="checkbox" name="java" value="java" />&nbsp;Java</td> <td id="secondTD" style="width:200px;"> <div id="javaRatingDiv" style="display:none"> <input name="javaRating" type="radio" value="1" class="star"/> <input name="javaRating" type="radio" value="2" class="star"/> </div> </td> </tr> </table> </tr> </table> </div>

    Read the article

  • What is a good generic sibling control Javascript communication strategy?

    - by James
    I'm building a webpage that is composed of several controls, and trying to come up with an effective somewhat generic client side sibling control communication model. One of the controls is the menu control. Whenever an item is clicked in here I wanted to expose a custom client side event that other controls can subscribe to, so that I can achieve a loosely coupled sibling control communication model. To that end I've created a simple Javascript event collection class (code below) that acts as like a hub for control event registration and event subscription. This code certainly gets the job done, but my question is is there a better more elegant way to do this in terms of best practices or tools, or is this just a fools errand? /// Event collection object - acts as the hub for control communication. function ClientEventCollection() { this.ClientEvents = {}; this.RegisterEvent = _RegisterEvent; this.AttachToEvent = _AttachToEvent; this.FireEvent = _FireEvent; function _RegisterEvent(eventKey) { if (!this.ClientEvents[eventKey]) this.ClientEvents[eventKey] = []; } function _AttachToEvent(eventKey, handlerFunc) { if (this.ClientEvents[eventKey]) this.ClientEvents[eventKey][this.ClientEvents[eventKey].length] = handlerFunc; } function _FireEvent(eventKey, triggerId, contextData ) { if (this.ClientEvents[eventKey]) { for (var i = 0; i < this.ClientEvents[eventKey].length; i++) { var fn = this.ClientEvents[eventKey][i]; if (fn) fn(triggerId, contextData); } } } } // load new collection instance. var myClientEvents = new bsdClientEventCollection(); // register events specific to the control that owns it, this will be emitted by each respective control. myClientEvents.RegisterEvent("menu-item-clicked"); Here is the part where this code above is consumed by source and subscriber controls. // menu control $(document).ready(function() { $(".menu > a").click( function(event) { //event.preventDefault(); myClientEvents.FireEvent("menu-item-clicked", $(this).attr("id"), null); }); }); <div style="float: left;" class="menu"> <a id="1" href="#">Menu Item1</a><br /> <a id="2" href="#">Menu Item2</a><br /> <a id="3" href="#">Menu Item3</a><br /> <a id="4" href="#">Menu Item4</a><br /> </div> // event subscriber control $(document).ready(function() { myClientEvents.AttachToEvent("menu-item-clicked", menuItemChanged); myClientEvents.AttachToEvent("menu-item-clicked", menuItemChanged2); myClientEvents.AttachToEvent("menu-item-clicked", menuItemChanged3); }); function menuItemChanged(id, contextData) { alert('menuItemChanged ' + id); } function menuItemChanged2(id, contextData) { alert('menuItemChanged2 ' + id); } function menuItemChanged3(id, contextData) { alert('menuItemChanged3 ' + id); }

    Read the article

  • Retrieve specific preceding sibling nodes attributes

    - by Matthieu BROUILLARD
    Is there an XPath way of recovering directly one specific attribute of preceding sibling nodes of an XML node using an XPath query? In the following example, I would like to retrieve the values of the alt attribute of each img nodes that precede the div element marked with the id=marker. <content> <img alt="1" src="file.gif" /> <img alt="2" src="file.gif" /> <img alt="3" src="file.gif" /> <img alt="4" src="file.gif" /> <div id='marker'></div> </content> For this example, I want to retrieve the values 1 2 3 4. I use the following XPath query //div[@id='marker']/preceding-sibling::img in order to retrieve the node list I want <img alt="1" src="file.gif"/> <img alt="2" src="file.gif"/> <img alt="3" src="file.gif"/> <img alt="4" src="file.gif"/> As it is a node list I can then iterate on the nodes to retrieve the attribute value I am looking for, but is there an XPath way of doing it? I would have expected to be able to write something like: //div[@id='marker']/preceding-sibling::img@alt or //div[@id='marker']/preceding-sibling@alt::img but I don't even know if it is possible once you have used an XPath Axe like preceding-sibling.

    Read the article

  • jquery fail to retrieve accurate data from sibling field.

    - by i need help
    wonder what's wrong <table id=tblDomainVersion> <tr> <td>Version</td> <td>No of sites</td> </tr> <tr> <td class=clsversion>1.25</td> <td><a id=expanddomain>3 sites</a><span id=spanshowall></span></td> </tr> <tr> <td class=clsversion>1.37</td> <td><a id=expanddomain>7 sites</a><span id=spanshowall></span></td> </tr> </table> $('#expanddomain').click(function() { //the siblings result incorrect //select first row will work //select second row will no response var versionforselected= $('#expanddomain').parent().siblings("td.clsversion").text(); alert(versionforselected); $.ajax({ url: "ajaxquery.php", type: "POST", data: 'version='+versionforselected, timeout: 900000, success: function(output) { output= jQuery.trim(output); $('#spanshowall').html(output); }, }); });

    Read the article

  • XSLT - Comparing preceding-sibling's elements with current's node element

    - by siondream
    Hello, I have this XML file: <recursos> <recurso url="http://w3c.com"> <descripcion>Consorcio W3C</descripcion> <tipo>externo</tipo> <idioma>ingles</idioma> <contenido>General</contenido> <unidad>Unidad 2</unidad> </recurso> <recurso url="http://html.com"> <descripcion>Especificación HTML</descripcion> <tipo>externo</tipo> <idioma>castellano</idioma> <contenido>HTML</contenido> <version>4.01</version> <unidad>Unidad 3</unidad> </recurso> </recursos> I want to compare one "recurso"'s preceding sibling element "unidad" with the "unidad" of the current "recurso" to check if they're different. I was trying: <xsl:if test="preceding-sibling::recurso[position()=1]::unidad != unidad"> </xsl:if> But I know it's horribly wrong :( I hope you could help me, thank you very much.

    Read the article

  • nextSibling issue, again... sorry...

    - by SoLoGHoST
    Ok, I am using insertRow to insert a TR element into a table, but for some reason it doesn't count that inserted TR element as a sibling of the others when I do nextSibling on it. For example, consider the following table. <table id="myTable"> <tr id="row_0"> <td colspan="3">Row 1</td> </tr> <tr id="tr_0_0"> <td>Option 1</td> <td>Option2</td> <td>Option 3</td> </tr> <tr id="tr_0_1"> <td>Option 1</td> <td>Option 2</td> <td>Option 3</td> </tr> </table> So after I do this: var lTable = document.getElementById("myTable"); var trEle = lTable.insertRow(-1); trEle.id = "tr_0_2"; var cell1 = trEle.insertCell(0); cell1.innerHTML = "Option 1"; var cell2 = trEle.insertCell(1); cell2.innerHTML = "Option 2"; var cell3 = trEle.insertCell(-1); cell3.innerHTML = "Option 3"; Then I use this approach to get all of the siblings, but it NEVER gives me the last sibling in here, but ONLY if it's been added via insertRow, because it gets all nextSiblings just fine, but once I add a sibling via insertRow it never gives me that last Sibling, argggg.... var tempTr = document.getElementById("row_0"); var totalSibs = 0; while(tempTr.nextSibling != null) { var tempId = tempTr.id; // If no id, not an element, or not a tr_0 id. if (!tempId || tempTr.nodeType != 1 || tempId.indexOf("tr_0") != 0) { tempTr = tempTr.nextSibling; continue; } // This NEVER ALERTS the last id of the row that was inserted using insertRow, arggg. alert(tempId); totalSibs++; tempTr = tempTr.nextSibling; } So, totalSibs should return 3 because after I inserted the row, there should be 3 Siblings, but instead returns 2 and never counts the 3rd Sibling.... arggg. Can someone please help me here?? Thank a lot, you guys/gals are Awesome!

    Read the article

  • How to preserve sibling element position when one sibling is absolutely positioned?

    - by Casey
    In the snippet below, the child div is normally positioned until it is :hovered , when it becomes absolutely positioned. The reasoning behind this markup is to simulate a popup style in a limited environment where I can't use a <select> (among other limitations). When child is hovered, the sibling elements jump around, which is expected, as the contents of the block have changed. But how can I preserve their positioning? That is, what CSS can I add to prevent the siblings from jumping around when child is hovered. Javascript is also not allowed, so please no answers using JS. HTML: <div class="container"> <div class="child"> <span class="d4"></span> <label><input type="radio" name="radio" value="1"/>One</label> <label><input type="radio" name="radio" value="2"/>Two</label> </div> <input type="text" name="sibling"/> <button name="sibling2">Button</button> </div> CSS: .container, .child, button { display:inline-block; } .child { vertical-align: middle; width: 35px; height: 35px; } .child:hover { background: gray; position:absolute; width: 100px; height: auto; } .child:hover > .d4 { display: none; } .child label { display:none; } .child:hover label { display: inline-block; } .d4 { background-position: -411px -1px; width: 35px; height: 35px; background-image: url("https://i.imgur.com/zkgyBOi.png"); background-repeat: no-repeat; color: transparent; display: inline-block; } Here's a fiddle: http://jsfiddle.net/cpctZ/1/

    Read the article

  • jQuery sibling selector?

    - by Brett
    Hi, I have a table which I'm trying to do a pricing list, that auto-computes the tax component.. I'm getting the value from price_1, applying a math cal, and saving it to tax_1. I could read the number of the end of the id, but hopefully there is a cleaner way with jQuery. E.g. I would have a lot of fields like.. price_1 price_2 price_3 tax_1 tax_2 tax_3 etc... I can use the following code to call jQuery on change of a price, and get the value of that price. How do I update the tax field next to it? should I use a sibling selector or something?? $('#pricing').delegate("input", "change", function(){ $(this).val() /* the value of the price */; })

    Read the article

  • jquery selecting sibling node of the current node

    - by priyank.mp
    How do I select sibling node of the current node? Here is the snippet: <div id="main"> <a class="test" href="test.html">Hello</a> <div>Some text</div> </div> //script $(".test").click(function() { $("this:parent > div").toggle(); }); or $(".test").click(function() { $("this ~ div").toggle(); }); None of these works. I know I can access current object using $(this) but in this case I don't know how.

    Read the article

  • XPath for choosing a sibling after

    - by Arsen Zahray
    I've got following xml: <root> <a>value1</a> <b>value2</b> <c>value3</c> <a>value5</a> <d>value4</d> <b>value2</b> <b>value3</b> <a>value7</a> </root> I want to select the first sibling a after node //b[text()='value2'] if it's not followed by an other b-node (in this case it will be <a>value5</a>, <a>value7</a> should not be selected). What's the xpath to do that? I'm using .net 4 and xpath 1.0

    Read the article

  • Resolve sibling folder in JavaScript Function

    - by Jamen Chu
    Hi, I am trying to pass into an JavaScript function two paths for an XML and XSLT. It would appear that in the sample HTML below that the use of "../xsl/filename" does not work for me in the xslt() function. If I specify the path as being "./filename" though this does work. Does anyone know how I can work around this or find some way that I can specify a sibling folder without an absolute path reference? I would prefer not to have to change my file paths as my development environment is set up with the xslt's, sample data and source code structured in a particular way. Thanks in advance Jamen <html> <head> <title></title> <script type="text/javascript" src="../lib/jsunit/app/jsUnitCore.js"></script> <script type="text/javascript" src="../lib/jquery-1.2.3.js"></script> <script type="text/javascript" src="../lib/jquery.xslt.js"></script> </head> <body> <div id="bla"></div> <script type="text/javascript"> $('#bla').xslt("../sampledata/response1.xml", "../xslt/resultFormatter.xsl"); //function testjQuery() { // $('#bla').xslt("../sampledata/response1.xml", "../xslt/resultFormatter.xsl"); //} </script> </body> </html>

    Read the article

  • HTML/CSS set div to height of sibling

    - by Paul
    I have 2 div's contained in a third. One of the contained div's is floated left, the other floated right. I would like the 2 sibling div's to always be at the same height, but am having a problem with this. So far I am only viewing the page in Firefox, and figured I'd worry about any cross-browser issues after I get it working in at least one browser. Here is the markup: <div id="main-container" class="border clearfix"> <div id="left-div" class="border"> ... </div> <div id="right-div" class="border"> ... </div> </div> Here is the CSS: #main-container { position: relative; min-height: 500px; } #left-div { position: relative; float: left; width: 700px; min-height: inherit; } #right-div { position: relative; float: right; width: 248px; min-height: inherit; height: inherit; } .clearfix:after { content: " "; display: block; height: 0; clear: both; visibility: hidden; } .clearfix { display: inline-block; _height: 1%; clear: both; } .clearfix { display: block; clear: both; } .border { border: solid 1px #000; } If the content in the #left-div is longer than 500px, the #right-div does not expand to match. In an example I tried, Firefox said the computed style height of the #main-container was 804px, the computed style height of the #left-div was 800px, and the computed style height of the #right-div was 586.2px, as it had expanded to fit it's own content. I understand I might be going about this the wrong way, and if this is a duplicate questions then I apologize, but I wasn't quite sure what to search under.

    Read the article

  • Prolog Family tree

    - by Tania
    Hi I have a Question in prolog , I did it but its not showing answers When i ask about the brothers,sisters,uncles,aunts This is what I wrote, what's wrong ? /*uncle(X, Y) :– male(X), sibling(X, Z), parent(Z, Y).*/ /*uncle(X, Y) :– male(X), spouse(X, W), sibling(W, Z), parent(Z, Y).*/ uncle(X,Y) :- parent(Z,Y), brother(X,Z). aunt(X,Y) :- parent(Z,Y), sister(X,Z). sibling(X, Y) :- parent(Z, X), parent(Z, Y), X \= Y. sister(X, Y) :- sibling(X, Y), female(X). brother(X, Y) :- sibling(X, Y), male(X). parent(Z,Y) :- father(Z,Y). parent(Z,Y) :- mother(Z,Y). grandparent(C,D) :- parent(C,E), parent(E,D). aunt(X, Y) :– female(X), sibling(X, Z), parent(Z, Y). aunt(X, Y) :– female(X), spouse(X, W), sibling(W, Z), parent(Z, Y). male(john). male(bob). male(bill). male(ron). male(jeff). female(mary). female(sue). female(nancy). mother(mary, sue). mother(mary, bill). mother(sue, nancy). mother(sue, jeff). mother(jane, ron). father(john, sue). father(john, bill). father(bob, nancy). father(bob, jeff). father(bill, ron). sibling(bob,bill). sibling(sue,bill). sibling(nancy,jeff). sibling(nancy,ron). sibling(jell,ron). And one more thing, how do I optimize the rule of the brother so that X is not brother to itself.

    Read the article

  • Robust LINQ to XML query for sibling key-value pairs

    - by awshepard
    (First post, please be gentle!) I am just learning about LINQ to XML in all its glory and frailty, trying to hack it to do what I want to do: Given an XML file like this - <list> <!-- random data, keys, values, etc.--> <key>FIRST_WANTED_KEY</key> <value>FIRST_WANTED_VALUE</value> <key>SECOND_WANTED_KEY</key> <value>SECOND_WANTED_VALUE</value> <!-- wanted because it's first --> <key>SECOND_WANTED_KEY</key> <value>UNWANTED_VALUE</value> <!-- not wanted because it's second --> <!-- nonexistent <key>THIRD_WANTED_KEY</key> --> <!-- nonexistent <value>THIRD_WANTED_VALUE</value> --> <!-- more stuff--> </list> I want to extract the values of a set of known "wanted keys" in a robust fashion, i.e. if SECOND_WANTED_KEY appears twice, I only want SECOND_WANTED_VALUE, not UNWANTED_VALUE. Additionally, THIRD_WANTED_KEY may or may not appear, so the query should be able to handle that as well. I can assume that FIRST_WANTED_KEY will appear before other keys, but can't assume anything about the order of the other keys - if a key appears twice, its values aren't important, I only want the first one. An anonymous data type consisting of strings is fine. My attempt has centered around something along these lines: var z = from y in x.Descendants() where y.Value == "FIRST_WANTED_KEY" select new { first_wanted_value = ((XElement)y.NextNode).Value, //... } My question is what should that ... be? I've tried, for instance, (ugly, I know) second_wanted_value = ((XElement)y.ElementsAfterSelf() .Where(w => w.Value=="SECOND_WANTED_KEY") .FirstOrDefault().NextNode).Value which should hopefully allow the key to be anywhere, or non-existent, but that hasn't worked out, since .NextNode on a null XElement doesn't seem to work. I've also tried to add in a .Select(t => { if (t==null) return new XElement("SECOND_WANTED_KEY",""); else return t; }) clause in after the where, but that hasn't worked either. I'm open to suggestions, (constructive) criticism, links, references, or suggestions of phrases to Google for, etc. I've done a fair share of Googling and checking around S.O., so any help would be appreciated. Thanks!

    Read the article

  • C# dictionary uniqueness for sibling classes using IEquatable<T>

    - by anthony
    I would like to store insances of two classes in a dictionary structure and use IEquatable to determine uniqueness of these instances. Both of these classes share an (abstract) base class. Consider the following classes: abstract class Foo { ... } class SubFoo1 : Foo { ... } class SubFoo2 : Foo { ... } The dictionary will be delcared: Dictionary<Foo, Bar> Which classes should be declared as IEquatable? And what should the generic type T be for those declarations? Is this even possible?

    Read the article

  • Float a div in top right corner without overlapping sibling header

    - by Maxime R.
    Having a div and a h1 inside a section, how do i float the div in the top right corner without overlapping the text of the header ? The HTML code is the following: <section> <h1>some long long long long header, a whole line, 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6</h1> <div><button>button</button></div> </section> I tried an absolute position relative to the parent but the text is overlapped, http://jsfiddle.net/FnpS8/2/ Using this CSS code: section { position: relative; } h1 { display: inline; } div { position: absolute; top: 0; right: 0; } I tried floating the div to the right but it doesn't remain in the top right corner, http://jsfiddle.net/P6xCw/2/ Using this CSS code: h1 { display: inline; } div { float: right; } ? I know there is a lot of similar questions but I couldn't find one solving this case.

    Read the article

  • Selecting an element based on text and attribute of its sibling, using Xpath

    - by Adam Asham
    Looking at the document, the goal is to select the second cell from the second row, in the first table. I've created the following expression: //row/td[2]/text()[td[@class="identifier"]/span[text()="identifier"]] but it does not return any rows. Unfortunately I do not see what's wrong. To me, it looks alright. The expression should: select the text in the second cell in any row where the text of a span equals to "identifier" and the span is located in cell with a "identifier" class I'd appreciate it if you could point out what I'm doing wrong. Sample XML document: <?xml version="1.0"?> <html> <table class="first"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td class="identifier"> <span>identifier</span> </td> <td> foo <span>ignore</span> bar </td> </tr> <tr> <td>row 3, cell 1</td> <td>row 3, cell 2</td> </tr> </table> <table class="second"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td class="identifier"> <span>not an identifier</span> </td> <td> not a target </td> </tr> <tr> <td>row 3, cell 1</td> <td>row 3, cell 2</td> </tr> </table> </html>

    Read the article

  • Sibling UIViewController Navigation

    - by Joo Park
    would anybody care to comment on this piece of code? It allows you to do "prev" or "next" once in the detail view of a uiviewcontroller. So, if you have 4 uiviewcontrollers, you can navigate from #3 to #2 with previous or #3 to #4 with next. It works, but, my question is, is this the best way to implement this? or, is there a better way. http://github.com/joop23/UIViewController

    Read the article

  • move xsl sibling node inside parent?

    - by user288929
    How can I get from this: <Include xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Component Feature="toplevel"> <File Id="fil8A88F8B155E29670FCA1B83F0E99E635" /> <TypeLib Id="{DC88F377-25DD-49C8-99D9-1FD8AE484362}" > <Interface Id="{5D12ED70-0B5A-49C4-A8A3-FC4C209295BA}" /> <Interface Id="{73E8EDB7-4293-496D-8ABD-F973F002A033}" /> </TypeLib> <TypeLib Id="{F3C9A192-17C2-4E25-ADB9-89FFEEC0403E}"> <Interface Id="{89FF44C6-979D-49B6-AF56-EC9509001DE4}" /> </TypeLib> </Component> </Include> to this: <Include xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Component Feature="toplevel"> <File Id="fil8A88F8B155E29670FCA1B83F0E99E635" > <TypeLib Id="{DC88F377-25DD-49C8-99D9-1FD8AE484362}" > <Interface Id="{5D12ED70-0B5A-49C4-A8A3-FC4C209295BA}" /> <Interface Id="{73E8EDB7-4293-496D-8ABD-F973F002A033}" /> </TypeLib> <TypeLib Id="{F3C9A192-17C2-4E25-ADB9-89FFEEC0403E}"> <Interface Id="{89FF44C6-979D-49B6-AF56-EC9509001DE4}" /> </TypeLib> </File> </Component> </Include> (move <TypeLib>s inside <File>...) Thanks,

    Read the article

  • Internet Explorer not incrementing number for non-sibling <li> elements

    - by biagidp
    I've got some html that looks like this: <ol> <div> <li>one</li> </div> <div> <li>two</li> </div> <div> <li>three</li> </div> </ol> Which looks like this in Chrome/Firefox: 1. one 2. two 3. three But looks like this in IE: 1. one 1. two 1. three If I change the code so that the li element is the parent of the div element instead of the other way around (so that all the li elements are siblings) IE renders it correctly. Anyone know what causes this or if this is the intended working behavior of IE? Furthermore is one way technically more correct than the other? <div><li></li></div> VS. <li><div></div></li> Thanks, David

    Read the article

  • casting between sibling classes, AS3

    - by felix-gasca
    I have two classes, derivedClassA and derivedClassB which both extend parentClass I'm declaring var o:parentClass and then, depending on what's going on, I want to cast o as either being of type derivedClassA or derivedClassB. Essentially, this: var o:parentClass ... if(shouldUseA) o = new derivedClassA(); else o = new derivedClassB(); o.doSomething(); But it's not working, I'm getting all sorts of errors. Isn't this how class inheritance works? I feel like I'm missing something really fundamental, but I can't figure out what. Am I supposed to be using interfaces instead? Is there another way of doing what I want?

    Read the article

1 2 3 4 5 6 7  | Next Page >